home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
kermit.columbia.edu
/
kermit.columbia.edu.tar
/
kermit.columbia.edu
/
newsgroups
/
misc.20020314-20021006
/
000328_fdc@columbia.edu_Thu Aug 29 12:06:56 EDT 2002.msg
< prev
next >
Wrap
Text File
|
2002-10-06
|
3KB
|
105 lines
Article: 13658 of comp.protocols.kermit.misc
Path: newsmaster.cc.columbia.edu!news.columbia.edu!news-not-for-mail
From: fdc@columbia.edu (Frank da Cruz)
Newsgroups: comp.protocols.kermit.misc
Subject: Re: scripting capturing of Cisco ARP tables
Date: 29 Aug 2002 12:06:47 -0400
Organization: Columbia University
Lines: 88
Message-ID: <aklgqn$2gv$1@watsol.cc.columbia.edu>
References: <3d6e39ea@yorrell.saard.net>
NNTP-Posting-Host: watsol.cc.columbia.edu
X-Trace: newsmaster.cc.columbia.edu 1030637208 6787 128.59.39.139 (29 Aug 2002 16:06:48 GMT)
X-Complaints-To: postmaster@columbia.edu
NNTP-Posting-Date: 29 Aug 2002 16:06:48 GMT
Xref: newsmaster.cc.columbia.edu comp.protocols.kermit.misc:13658
In article <3d6e39ea@yorrell.saard.net>,
Arthur Marsh <arthur.marsh@adelaide.edu.au> wrote:
: Hi, I've been out of practice with writing Kermit scripts and want to do
: the following:
:
: Given one series of IP addresses:
:
Put them in an array, loop thru the array, e.g.:
dcl \&a[] = 123.456.789.001 123.456.789.002 123.456.789.003 123.456.789.004
for \%i 1 \fdim(&a) 1 {
...
}
Or read the addresses into the array from a file, whatever. For more
about arrays, see the book and:
http://www.columbia.edu/kermit/ckermit70.html#x7.10
For file i/o, see:
http://www.columbia.edu/kermit/ckermit70.html#x1.22
: telnet to each IP address in turn,
:
set host \&a[\%i]
if fail ...
: send a:
:
: show arp
:
: command
:
: and send a space character as long as a "More" prompt appears
:
: For each line that starts with "Internet", log the 4th and 2nd space
: delimited string to a file.
:
Something like this:
fopen /write \%c outfile
if fail ...
lineout show arp ; Send "show arp" and CR
set flag on ; Loop control
while flag { ; Loop
clear input ; Clear INPUT buffer
minput 10 "\10" "More?" "Prompt>" ; Wait for trigger strings
if fail break
switch \v(minput) {
:1, if equal "\fleft(\v(input),8)" "Internet" {
fwrite \%c \v(input)
}
break
:2, output " "
break
:3, set flag off
}
}
Here you need to get the exact syntax of the More prompt and the
Cisco shell prompt.
Maybe each Cisco box has a different shell prompt. Then you need parallel
arrays for the IP addresses and the shell prompts. See the "mpservers"
sample script in the C-Kermit / K95 Script library:
http://www.columbia.edu/kermit/ckscripts.html
: There are a couple of variations.
:
: One device needs to be sent the comand
:
: session 15 <cr>
:
: after the initial log-in and before the "show arp" command.
:
: Some devices need
:
: session 15 <cr>
:
: followed by a second username/password (identical to the first)
: after the initial log-in and before the "show arp" command.
:
Use a SWITCH statement on the hostname/address.
- Frank